package org.redxentertainment.videomanager;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.BitmapFactory.Options;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;

public class VideoManagerDetails extends Activity {
	//-------------------------------------------------------------------------------------
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.video_list);
        
        Bitmap		thumb;
        ImageView	thumbView;
        TextView 	detailText;
        Bundle 		extras;
        
        BitmapFactory.Options options = new BitmapFactory.Options();
    	options.inSampleSize = 2;
        
        
        setContentView(R.layout.details);
 
        extras = getIntent().getExtras();
        
        /*
        thumbView = (ImageView)findViewById(R.id.catIcon);
		thumb = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory() + "/video/" + extras.getString("category") + "/icon.png");
		if(thumb != null) {
			thumbView.setImageBitmap(thumb);
		}
		*/
        
        thumbView = (ImageView)findViewById(R.id.vidIcon);
		thumb = MediaStore.Video.Thumbnails.getThumbnail(getContentResolver(), extras.getLong("id"), MediaStore.Video.Thumbnails.MINI_KIND, options);
		if(thumb != null) {
			thumbView.setImageBitmap(thumb);
		}
		
        detailText = (TextView)findViewById(R.id.title);
        detailText.setText( extras.getString("name") );
        
        detailText = (TextView)findViewById(R.id.category);
        detailText.setText( extras.getString("category") );
        
        detailText = (TextView)findViewById(R.id.path);
        detailText.setText( extras.getString("path") );
        
        detailText = (TextView)findViewById(R.id.size);
        detailText.setText( extras.getInt("size") + " MB" );
        
    }
    
}
